from django.db import models

# Create your models here.
from myproject.models import Myproject
from utils.baseModel import BaseModel


class Module(BaseModel):
    modulename = models.CharField(max_length=20, null=False, verbose_name='模块名称', default=None, db_column="module_name")
    pid = models.ForeignKey(to='self', to_field="id", on_delete=models.CASCADE, verbose_name='上级模块id', default=None,
                            null=True, db_column="pid")
    project = models.ForeignKey(to=Myproject, to_field="id", on_delete=models.CASCADE, verbose_name='所属模块id',
                                default=None, null=False, db_column="project_id")
    describe = models.TextField(max_length=30, default=None, null=True, verbose_name='描述')

    class Meta(object):
        db_table = 'module'
        ordering = ['-create_time']
